package org.scmpatrol.scm.connector;

import java.util.Date;
import java.util.List;

import org.scmpatrol.scm.SCMCommit;
import org.scmpatrol.scm.common.exception.SCMPatrolException;

/**
 * Basic interface for SCM connectors.
 * 
 */
public interface SCMConnector {
	public void init(SCMProperties properties) throws SCMPatrolException;

	/**
	 * Return revisions committed after the revision passed. <br>
	 * The passed revision is excluded.
	 * 
	 * @param from
	 *            return the revisions after this one
	 * @return List of {@see SCMCommit}
	 * @throws SCMPatrolException
	 *             TODO
	 */
	public List<SCMCommit> getCommits(String from, int limit) throws SCMPatrolException;

	/**
	 * Return revisions committed after the passed date. <br>
	 * To be returned, a revision must have a date greater than from.
	 * 
	 * @param since the date
	 *            return the revisions after this date
	 * @return List of {@see SCMCommit}
	 * @throws SCMPatrolException
	 *             TODO
	 */
	public List<SCMCommit> getCommits(Date since) throws SCMPatrolException;

	public SCMCommit getCommit(String revisionId) throws SCMPatrolException;

	public boolean haveNewCommits(String from) throws SCMPatrolException;

	public boolean haveNewCommits(Date from) throws SCMPatrolException;

	public String getLastRevisionId() throws SCMPatrolException;
	
	// TODO add getNextRevision
}
